<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>

<body>

    <input type="text" id="cname">
    <input type="text" id="sname">
    <button id="btnok">添加</button>

    <script>
        $(function () {
            // 注册事件
            $('#btnok').click(function () {
                // 发起ajax请求
                // 1.0 构造请求体参数对象
                let cname = $('#cname').val();
                let sname = $('#sname').val();

                let data = { cname, sname }

                // 2.0 发送
                $.ajax({
                    url: 'http://127.0.0.1:3006/api/addHeroSkin',
                    type: 'post',
                    data: data,
                    success: res => {
                        console.log(res);
                    }
                })
            })
        })
    </script>
</body>

</html>